<?php
error_reporting(0);
require "db/connect.php";

#echo "Database logging Success";

//$result = $db->query("SELECT * FROM people ") or die($db->error);

/*echo '<pre>'; 
print_r($result); 
echo "</pre>";*/

/* if ($result->num_rows){
    echo "Yay";
} */

if($result = $db->query("SELECT * FROM people")){
    if($count = $result->num_rows){
        echo '<p>', $count, '</p>';
    
        /*while($row = $result->fetch_assoc()){
            echo $row['first_name'], ' ', $row['last_name'], '<br>';
        } */
        
       // foreach($result->fetch_assoc() as $row)
        while($row = $result->fetch_object()) {
            //echo $row['first_name'], ' ', $row['last_name'], '<br>';
            echo $row->first_name, ' ', $row->last_name, '<br>';
        }

        //echo '<pre>', print_r($rows), '</pre>';
        $result->free();
    }
}
